Ext.onReady(function(){ 

Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'under';

var yesOrNoStore=new Ext.data.Store({ 
proxy:new Ext.data.HttpProxy({
url:'showType.do?type=YesNo',
method:'GET'
}), 
reader:new Ext.data.JsonReader({ },[
{name:'name'}, 
{name:'code'}
]) 
});
yesOrNoStore.load({ //加载下拉框的store
	callback:function(r,options,success){
		Ext.getCmp("twoHighFlag").setValue(Ext.getCmp("twoHighFlag").getValue());
		Ext.getCmp("limitedFlag").setValue(Ext.getCmp("limitedFlag").getValue());
		Ext.getCmp("inOutFlag").setValue(Ext.getCmp("inOutFlag").getValue());
		Ext.getCmp("groupFlag").setValue(Ext.getCmp("groupFlag").getValue());
		Ext.getCmp("confirmedSmallFlag").setValue(Ext.getCmp("confirmedSmallFlag").getValue());
		Ext.getCmp("publicFlag").setValue(Ext.getCmp("publicFlag").getValue());
	}
});
var countryStore=new Ext.data.Store({ 
	proxy:new Ext.data.HttpProxy({
	url:'showCountry.do',
	method:'POST'
	}), 
	reader:new Ext.data.JsonReader({ },[
	{name:'name'}, 
	{name:'code'}
	]) 
	}); 
	countryStore.load({ //加载下拉框的store
	callback:function(r,options,success){
		Ext.getCmp("countryCode").setValue(Ext.getCmp("countryCode").getValue());
	}
});

	var provinceStore = new Ext.data.Store({ 
	proxy:new Ext.data.HttpProxy({
	url:'showProvince.do',
	method:'GET'
	}), 
	reader:new Ext.data.JsonReader({ },[
	{name:'provinceCode'}, 
	{name:'provinceName'}
	]) 
	}); 
	provinceStore.load();

	 var cityStore = new Ext.data.Store({ 
					reader:new Ext.data.JsonReader({ },[
					{name:'cityCode'}, 
					{name:'cityName'}
					]) 
					});
var addCurrencyStore=new Ext.data.Store({ 
	proxy:new Ext.data.HttpProxy({
	url:'showType.do?type=Currency',
	method:'GET'
	}), 
	reader:new Ext.data.JsonReader({ },[
	{name:'name'}, 
	{name:'code'}
	])
	});
addCurrencyStore.load({ //加载下拉框的store
	callback:function(r,options,success){
	Ext.getCmp("capitalCurrency").setValue(Ext.getCmp("capitalCurrency").getValue());
	}
});

var addCustTypeStore=new Ext.data.Store({ 
	proxy:new Ext.data.HttpProxy({
	url:'showType.do?type=CustType',
	method:'GET'
	}), 
	reader:new Ext.data.JsonReader({ },[
	{name:'name'}, 
	{name:'code'}
	]) 
	}); 
addCustTypeStore.load({ //加载下拉框的store
	callback:function(r,options,success){
	Ext.getCmp("custType").setValue(Ext.getCmp("custType").getValue());
	}
});

var groupClientStore=new Ext.data.Store({ 
	proxy:new Ext.data.HttpProxy({
	url:'showType.do?type=GroupClient',
	method:'GET'
	}), 
	reader:new Ext.data.JsonReader({ },[
	{name:'name'}, 
	{name:'code'}
	]) 
	}); 
groupClientStore.load({ //加载下拉框的store
	callback:function(r,options,success){
	Ext.getCmp("groupFlag").setValue(Ext.getCmp("groupFlag").getValue());
	}
});

var addBelongTypeStore=new Ext.data.Store({ 
proxy:new Ext.data.HttpProxy({
url:'showType.do?type=BelongType',
method:'GET'
}), 
reader:new Ext.data.JsonReader({ },[
{name:'name'}, 
{name:'code'}
]) 
}); 
addBelongTypeStore.load({ //加载下拉框的store
	callback:function(r,options,success){
	Ext.getCmp("belongType").setValue(Ext.getCmp("belongType").getValue());
	}
});


var addOrgTypeStore=new Ext.data.Store({ 
proxy:new Ext.data.HttpProxy({
url:'showType.do?type=OrgType',
method:'GET'
}), 
reader:new Ext.data.JsonReader({ },[
{name:'name'}, 
{name:'code'}
]) 
}); 
addOrgTypeStore.load({ //加载下拉框的store
	callback:function(r,options,success){
	Ext.getCmp("orgType").setValue(Ext.getCmp("orgType").getValue());
	}
});

var addCustStatusStore=new Ext.data.Store({ 
proxy:new Ext.data.HttpProxy({
url:'showType.do?type=CustStatus',
method:'GET'
}), 
reader:new Ext.data.JsonReader({ },[
{name:'name'}, 
{name:'code'}
]) 
}); 
addCustStatusStore.load({ //加载下拉框的store
	callback:function(r,options,success){
	Ext.getCmp("custStatus").setValue(Ext.getCmp("custStatus").getValue());
	}
});

var addCustScopeStore=new Ext.data.Store({ 
proxy:new Ext.data.HttpProxy({
url:'showType.do?type=CustScope',
method:'GET'
}), 
reader:new Ext.data.JsonReader({ },[
{name:'name'}, 
{name:'code'}
]) 
}); 
addCustScopeStore.load({ //加载下拉框的store
	callback:function(r,options,success){
	Ext.getCmp("custScope").setValue(Ext.getCmp("custScope").getValue());
	}
});

var addIndustryTypeLevelOneStore=new Ext.data.Store({ 
proxy:new Ext.data.HttpProxy({
url:'showIndustryTypeLevelOne.do',
method:'GET'
}), 
reader:new Ext.data.JsonReader({ },[
{name:'name'}, 
{name:'code'}
]) ,
autoLoad:true
}); 

var addIndustryTypeLevelTwoStore=new Ext.data.Store({  
	reader:new Ext.data.JsonReader({ },[
	{name:'name'}, 
	{name:'code'}
	])
	}); 

//客户基本信息
var addForm = new Ext.form.FormPanel({ 
id: 'addForm', 
title: '客户基本信息', 
renderTo:"list",
height: 620, 
//样式 
bodyStyle: 'margin:5px;text-align:left;padding:5px 60px;', 
frame: true, 
xtype: 'filedset', 
labelWidth: 120, 
items: 
[ { xtype: 'fieldset', 
collapsible: true, 
autoHeight: true, 
autoWidth: true, 
items: 
[
 {layout:"column",
		items:[{
			columnWidth : .5, // 该列有整行中所占百分比
		           layout : "form",
		           items : [{}]
		    },{
			columnWidth : .5, // 该列有整行中所占百分比
		           layout : "form",
		           items : [{
		        	   xtype: 'textfield', 
						id:'custId',
						name: 'custId', 
						fieldLabel: '客户编号', 
						width: 200,
						hidden:true,
		           }
		]} 
]},

		 {layout:"column",
			items:[{
				columnWidth : .5, // 该列有整行中所占百分比
			           layout : "form",
			           items : [{
			xtype: 'textfield', 
				id:'custName',
				name: 'custName', 
				fieldLabel: '客户名称', 
				readOnly:true,
				width: 200
			}
			]},{
				columnWidth : .5, // 该列有整行中所占百分比
			           layout : "form",
			           items : [{
			        	   xtype: 'textfield', 
							id:'custNo',
							name: 'custNo', 
							fieldLabel: '客户号', 
							//readOnly:true,
							width: 200
			
			}
			]} 
			]},
	{layout:"column",
		items:[{
			columnWidth : .5, // 该列有整行中所占百分比
		           layout : "form",
		           items : [{
		        	   xtype: 'combo', 
		    			id : "custType",
		                 store :addCustTypeStore,
		                 fieldLabel: '客户类型',
		                 valueField : 'code',
		                 displayField : 'name',
		                 typeAhead : true,
		                 width: 200,
		                 mode:'remote', 
		                 emptyText : '请选择客户类型...',
		                // editable: false,
		   		   	  readOnly:true,
		                 triggerAction : 'all',
		                 selectOnFocus : true,
		                 hiddenName:'custType'
		}
		]},{
			columnWidth : .5, // 该列有整行中所占百分比
		           layout : "form",
		           items : [{
		        	   xtype: 'textfield', 
		       		id:'simpleName',
		       		name: 'simpleName', 
		       		fieldLabel: '客户简称', 
		       		width: 200
		}
		]} 
		]},
	
{
layout:"column",
items:[{
	columnWidth : .5, // 该列有整行中所占百分比
           layout : "form",
           items : [{
			xtype: 'textfield', 
		id:'busiLicenseId',
		name: 'busiLicenseId', 
		fieldLabel: '营业执照代码', 
		readOnly:true,
		width: 200 
}
]},{
	columnWidth : .5, // 该列有整行中所占百分比
           layout : "form",
           items : [{
xtype: 'textfield', 
	id:'organizationId',
	name: 'organizationId', 
	fieldLabel: '组织机构代码', 
	readOnly:true,
	width: 200 
}
]} 
]},
{
	layout:"column",
	items:[{
		columnWidth : .5, // 该列有整行中所占百分比
	           layout : "form",
	           items : [{
			xtype: 'textfield', 
			id:'englishName',
			name: 'englishName', 
			fieldLabel: '客户名称(英文)', 
			width: 200
	}
	]},{
		columnWidth : .5, // 该列有整行中所占百分比
	           layout : "form",
	           items : [{
			xtype: 'textfield', 
			id:'simpleEnName',
			name: 'simpleEnName', 
			fieldLabel: '客户简称(英文)', 
			width: 200
	}
	]} 
	]},
	{
		layout:"column",
		items:[{
			columnWidth : .5, // 该列有整行中所占百分比
			layout : "form",
	           items : [{
	        	   xtype: 'combo', 
	        	   id : "countryCode",
	              store :countryStore,
	              fieldLabel: '所在国家',
	              valueField : 'code',
	              displayField : 'name',
	              emptyText : '请选择国家...',
	              editable: false,
	              typeAhead : true,
	              allowBlank : false,
	              blankText:'请选择国家',
	              width: 200,
	              mode:'remote',  
	              hiddenName:'countryCode',
	              triggerAction : 'all',
	              selectOnFocus : true,
	              listeners:{        
	                  select : function(combo, record,index)   
	                  {   
	       			var cityCombo = Ext.getCmp('cityCode');
	       			var provinceCombo = Ext.getCmp('provinceCode');
	               
	                if(combo.value=='109'){
	                	provinceCombo.enable();
	                	cityCombo.enable();
	                }else{
	                	provinceCombo.clearValue(); 
	                	cityCombo.clearValue(); //可以实现当下拉值变更时，清空之前下拉选项中的值   
	                	provinceCombo.disable();
	                	cityCombo.disable();
	                }
	                Ext.getCmp('countryCodeNo').setValue(combo.value);
	                
	              }
	            }
	              
	}]},{
			columnWidth : .5, // 该列有整行中所占百分比
		           layout : "form",
		           items : [{
				xtype: 'textfield', 
				id:'countryCodeNo',
				name: 'countryCodeNo', 
				fieldLabel: '所在国家码', 
				width: 200
		}
		]} 
		]},
		{
			layout:"column",
			items:[{
				columnWidth : .5, // 该列有整行中所占百分比
			           layout : "form",
			           items : [{
			        	   xtype: 'combo', 
			        	   id : "provinceCode",
			              store :provinceStore,
			              fieldLabel: '所在省份',
			              valueField : 'provinceCode',
			              displayField : 'provinceName',
			              typeAhead : true,
			              width: 200,
			              mode:'remote', 
			              emptyText : '请选择省份...',
			              allowBlank : false,
			              blankText:'请选择省份',
			              editable: false,
			              triggerAction : 'all',
			              selectOnFocus : true,
			              hiddenName:'provinceCode',
			               listeners:{        
			        	   select : function(combo, record,index)   
			        	   {   
			        	   		var cityCombo = Ext.getCmp('cityCode');
			        	   		cityCombo.clearValue(); //可以实现当下拉值变更时，清空之前下拉选项中的值 
			        	   		cityStore.proxy =new Ext.data.HttpProxy({
			        	   				url:'showCity.do?provinceId='+combo.value,
			        	   				method:'GET'
			        	   		});
						
			                  
			        	   		cityStore.load(); //加载下拉框的store  
			        	   		Ext.getCmp('areaCodeNo').setValue(combo.value);
			        	   }      
			           }
			}]},{
				columnWidth : .5, // 该列有整行中所占百分比
			           layout : "form",
			           items : [{
					xtype: 'textfield', 
					id:'areaCodeNo',
					name: 'areaCodeNo', 
					fieldLabel: '所在区域码', 
					width: 200
			}
			]} 
			]},
			
			{
				layout:"column",
				items:[{
					columnWidth : .5, // 该列有整行中所占百分比
				    layout : "form",
				    items : [{
			        	   xtype: 'combo', 
			        	   id : "cityCode",
			              store :cityStore,
			            fieldLabel: '所在城市',
			              valueField : 'cityCode',
			              displayField : 'cityName',
			              emptyText : '请选择城市...',
			              editable: false,
			              typeAhead : true,
			              allowBlank : false,
			              blankText:'请选择城市',
			              width: 200,
			              mode:'remote',  
			              triggerAction : 'all',
			              selectOnFocus : true,
			              hiddenName:'cityCode',
			              listeners:{        
				        	   select : function(combo, record,index)   
				        	   { 
				        	   		Ext.getCmp('areaCodeNo').setValue(combo.value);
				        	   }      
				           }
				}
				]},{
					columnWidth : .5, // 该列有整行中所占百分比
				           layout : "form",
				           items : [{
						
				}
				]} 
				]},			
			
			
			
{
layout:"column",
items:[{
	columnWidth : .5, // 该列有整行中所占百分比
           layout : "form",
           items : [{
	xtype: 'combo', 
 id : "belongType",
              store :addBelongTypeStore,
              fieldLabel: '所有制类别',
              valueField : 'code',
              displayField : 'name',
              typeAhead : true,
              width: 200,
              mode:'remote', 
              emptyText : '请选择所有制类别...',
              editable: false,
              allowBlank : false,
              blankText:'请选择所有制类别',
              triggerAction : 'all',
              selectOnFocus : true,
              hiddenName:'belongType'
}
]},{
	columnWidth : .5, // 该列有整行中所占百分比
           layout : "form",
           items : [{
	xtype: 'combo', 
 id : "orgType",
              store :addOrgTypeStore,
            fieldLabel: '组织类别',
              valueField : 'code',
              displayField : 'name',
              emptyText : '请选择组织类别...',
              editable: false,
              typeAhead : true,
              width: 200,
              mode:'remote',  
              allowBlank : false,
              blankText:'请选择组织类别',
              triggerAction : 'all',
              selectOnFocus : true,
              hiddenName:'orgType'
}
]} 
]},

{
layout:"column",
items:[{
	columnWidth : .5, // 该列有整行中所占百分比
           layout : "form",
           items : [{
           xtype: 'datefield',
			id: 'establishDate', 
			name: 'establishDate', 
			fieldLabel: '成立时间',
			allowBlank : false,
            blankText:'请填写成立时间',
			allowBlank: true,
			editable:false,  
			format : 'Y-m-d' ,
			width: 200
}
]},{
	columnWidth : .5, // 该列有整行中所占百分比
           layout : "form",
           items : [{
           xtype: 'datefield',
			id: 'closeDate', 
			name: 'closeDate', 
			fieldLabel: '财年截止日期',
			allowBlank : false,
            blankText:'请填写财年截止日期',
			allowBlank: true,
			editable:false,  
			format : 'Y-m-d' ,
			width: 200
}
]} 
]},

{
layout:"column",
items:[{
	columnWidth : .5, // 该列有整行中所占百分比
           layout : "form",
           items : [{
          xtype: 'textfield', 
		id:'registercapital',
		name: 'registercapital', 
		fieldLabel: '注册资本（元）', 
		regex:/^[0-9]+\.{0,1}[0-9]{0,2}$/,
 		regexText:'只能输入整数或小数！' , 
		width: 200
}
]},{
	columnWidth : .5, // 该列有整行中所占百分比
           layout : "form",
           items : [{
          xtype: 'combo', 
 			id : "capitalCurrency",
              store :addCurrencyStore,
            fieldLabel: '币种',
              valueField : 'code',
              displayField : 'name',
              emptyText : '请选择币种...',
              editable: false,
              typeAhead : true,
              width: 200,
              mode:'remote',  
              triggerAction : 'all',
              selectOnFocus : true,
              hiddenName:'capitalCurrency'
}
]} 
]},
{layout:"column",
	items:[{
		columnWidth : .5, // 该列有整行中所占百分比
        layout : "form",
        items : [{
	        xtype: 'textfield', 
			id:'receiveRate',
			name: 'receiveRate', 
			fieldLabel: '注册资本到位率(%)', 
			regex:/^[0-9]+\.{0,1}[0-9]{0,5}$/,
	 		regexText:'只能输入整数或5位小数！' , 
			width: 200
        }]
    },{
		columnWidth : .5, // 该列有整行中所占百分比
		layout : "form",
        items : [{
        	xtype: 'textfield', 
			id:'peopleNum',
			name: 'peopleNum', 
			allowBlank : false,
            blankText:'请填写企业人数',
			fieldLabel: '企业人数', 
			regex:/^[0-9]+\.{0,1}[0-9]{0,2}$/,
 			regexText:'请输入正确格式' , 
			width: 200
        }]
    }]
},
{layout:"column",
	items:[{
		columnWidth : .5, // 该列有整行中所占百分比
	           layout : "form",
	           items : [{
				xtype: 'combo', 
				 id : "custScope",
	              store :addCustScopeStore,
	              fieldLabel: '企业规模',
	              valueField : 'code',
	              displayField : 'name',
	              typeAhead : true,
	              width: 200,
	              allowBlank : false,
	              blankText:'请选择企业规模',
	              mode:'remote', 
	              emptyText : '请选择企业规模...',
	              editable: false,
	              triggerAction : 'all',
	              selectOnFocus : true,
	              hiddenName:'custScope'
	}]},{
		columnWidth : .5, // 该列有整行中所占百分比
        layout : "form",
	    items : [{
			xtype: 'combo', 
			 id : "custStatus",
	       store :addCustStatusStore,
	       fieldLabel: '客户状态',
	       valueField : 'code',
	       displayField : 'name',
	       typeAhead : true,
	       width: 200,
	       mode:'remote', 
	       emptyText : '请选择客户状态...',
	       editable: false,
	       triggerAction : 'all',
	       selectOnFocus : true,
	       hiddenName:'custStatus'
	           
	}]} 
	]},
	
	{layout:"column",
		items:[{
			columnWidth : .5, // 该列有整行中所占百分比
			layout : "form",
			items : [{
				xtype: 'combo', 
		 		id : "IndustryTypeLevelOne",
		       store :addIndustryTypeLevelOneStore,
		       fieldLabel: '行业大类',
		       valueField : 'code',
		       displayField : 'name',
		       typeAhead : true,
		       width: 200,
		       mode:'remote', 
		       allowBlank : false,
	           blankText:'请选择行业大类',
		       emptyText : '请选择行业大类型...',
		       editable: false,
		       triggerAction : 'all',
		       selectOnFocus : true,
		       hiddenName:'industryTypeLevelOne' ,
		       listeners:{
		           select : function(combo, record,index)   
		           {
					var industryTypeLevelTwoCombo = Ext.getCmp('IndustryTypeLevelTwo');
					industryTypeLevelTwoCombo.clearValue(); //可以实现当下拉值变更时，清空之前下拉选项中的值   
					addIndustryTypeLevelTwoStore.proxy =new Ext.data.HttpProxy({
					url:'showIndustryTypeLevelTwo.do?LevelOneId='+combo.value,
					method:'GET'
					}); 
					addIndustryTypeLevelTwoStore.load(); //加载下拉框的store      
		           }      
		       }
	}]},{
			columnWidth : .5, // 该列有整行中所占百分比
			layout : "form",
		    items : [{
		    	xtype: 'combo', 
		 		id : "IndustryTypeLevelTwo",
		       store :addIndustryTypeLevelTwoStore,
		       fieldLabel: '行业子类',
		       valueField : 'code',
		       displayField : 'name',
		       typeAhead : true,
		       width: 200,
		       mode:'remote', 
		       emptyText : '请选择行业子类型...',
		       allowBlank : false,
	           blankText:'请选择行业子类',
		       editable: false,
		       triggerAction : 'all',
		       selectOnFocus : true,
		       hiddenName:'industryTypeLevelTwo'        
		           
		}
		]} 
		]},{
			layout:"column",
			items:[{
				columnWidth : .5, // 该列有整行中所占百分比
			    layout : "form",
			    items : [{
					xtype: 'textfield', 
					id:'debtCardNo',
					name: 'debtCardNo', 
					fieldLabel: '贷款卡号', 
					allowBlank : false,
		            blankText:'请填写贷款卡号',
					readOnly:false,
					width: 200 
			    }]},{
				columnWidth : .5, // 该列有整行中所占百分比
			    layout : "form",
			    items : [{
			    	xtype: 'textfield', 
			    	id:'debtCardPwd',
			    	name: 'debtCardPwd', 
			    	fieldLabel: '贷款卡密码', 
			    	readOnly:false,
			    	width: 200 
			    }]}
			]},{
				layout:"column",
				items:[{
					columnWidth : .5, // 该列有整行中所占百分比
				           layout : "form",
				           items : [{
				        	   xtype: 'datefield',
								id: 'relationshipDate', 
								name: 'relationshipDate', 
								fieldLabel: '建立信贷关系的时间',
								allowBlank: true,
								editable:false,  
								format : 'Y-m-d' ,
								width: 200
				}
				]},{
					columnWidth : .5, // 该列有整行中所占百分比
				           layout : "form",
				           items : [{
				        	   xtype: 'textfield', 			
						    	id:'debtPercent',
								name: 'debtPercent', 
								fieldLabel: '我行贷款占比(%)', 
								regex:/^[0-9]+\.{0,1}[0-9]{0,2}$/,
						 	    regexText:'只能输入整数或小数！' , 
								width: 200
				}
				]} 
			]},{layout:"column",
				items:[{
					columnWidth : .5, // 该列有整行中所占百分比
				           layout : "form",
				           items : [{
							xtype: 'combo', 
							 id : "twoHighFlag",
				              store :yesOrNoStore,
				              fieldLabel: '是否两高企业',
				              valueField : 'code',
				              displayField : 'name',
				              typeAhead : true,
				              width: 200,
				              allowBlank : false,
				              mode:'remote', 
				              editable: false,
				              triggerAction : 'all',
				              selectOnFocus : true,
				              allowBlank: true,
				              hiddenName:'twoHighFlag'
				}]},{
					columnWidth : .5, // 该列有整行中所占百分比
			        layout : "form",
				    items : [{
						xtype: 'combo', 
						 id : "limitedFlag",
				       store :yesOrNoStore,
				       fieldLabel: '限制性或监控行业',
				       valueField : 'code',
				       displayField : 'name',
				       typeAhead : true,
				       width: 200,
				       mode:'remote', 
				       editable: false,
				       triggerAction : 'all',
				       allowBlank: true,
				       selectOnFocus : true,
				       hiddenName:'limitedFlag'
				}]} 
				]},{layout:"column",
					items:[{
						columnWidth : .5, // 该列有整行中所占百分比
					           layout : "form",
					           items : [{
								xtype: 'combo', 
								 id : "inOutFlag",
					              store :yesOrNoStore,
					              fieldLabel: '是否有进出口权',
					              valueField : 'code',
					              displayField : 'name',
					              typeAhead : true,
					              width: 200,
					              allowBlank : false,
					              mode:'remote', 
					              editable: false,
					              triggerAction : 'all',
					              selectOnFocus : true,
					              allowBlank: true,
					              hiddenName:'inOutFlag'
					}]},{
						columnWidth : .5, // 该列有整行中所占百分比
				        layout : "form",
					    items : [{
							xtype: 'combo', 
							 id : "groupFlag",
					       store :groupClientStore,
					       fieldLabel: '集团客户标识',
					       valueField : 'code',
					       displayField : 'name',
					       typeAhead : true,
					       width: 200,
					       mode:'remote', 
					       editable: false,
					       triggerAction : 'all',
					       allowBlank: true,
					       selectOnFocus : true,
					       hiddenName:'groupFlag'
					}]} 
					]},{layout:"column",
						items:[{
							columnWidth : .5, // 该列有整行中所占百分比
				           layout : "form",
				           items : [{
				        	   xtype: 'combo', 
								 id : "confirmedSmallFlag",
					              store :yesOrNoStore,
					              fieldLabel: '是否我行认定小企业',
					              valueField : 'code',
					              displayField : 'name',
					              typeAhead : true,
					              width: 200,
					              allowBlank : false,
					              mode:'remote', 
					              editable: false,
					              triggerAction : 'all',
					              selectOnFocus : true,
					              allowBlank: true,
					              hiddenName:'confirmedSmallFlag'
						}]},{
							columnWidth : .5, // 该列有整行中所占百分比
					        layout : "form",
						    items : [{
						    	xtype: 'combo', 
								 id : "publicFlag",
					              store :yesOrNoStore,
					              fieldLabel: '是否上市公司',
					              valueField : 'code',
					              displayField : 'name',
					              typeAhead : true,
					              width: 200,
					              allowBlank : false,
					              mode:'remote', 
					              editable: false,
					              triggerAction : 'all',
					              selectOnFocus : true,
					              allowBlank: true,
					              hiddenName:'publicFlag'
						}]} 
						]},{
					layout:"column",
					items:[{
						columnWidth : .5, // 该列有整行中所占百分比
					    layout : "form",
					    items : [{
							xtype: 'textfield', 
							id:'nationalTaxNo',
							name: 'nationalTaxNo', 
							fieldLabel: '国税号', 
							readOnly:false,
							allowBlank : false,
				            blankText:'请填写国税号',
							width: 200 ,
							
					    }]},{
						columnWidth : .5, // 该列有整行中所占百分比
					    layout : "form",
					    items : [{
					    	xtype: 'textfield', 
					    	id:'localTaxNo',
					    	name: 'localTaxNo', 
					    	fieldLabel: '地税号', 
					    	allowBlank : false,
				            blankText:'请填写地税号',
					    	readOnly:false,
					    	width: 200 
					    }]}
					]}

] 
}],
buttonAlign:'right',
buttons: 
[  
{ text: '保存', handler: editFunction } ,
{ text: '下一步', handler: editFunctionAndNext }
] 
});


//表单加载数据
addForm.form.load({  
    //waitMsg : '正在加载数据请稍后',
    //waitTitle : '提示',
    url : 'customer/getGeneral.do', 
    method:'post',
    success:function(form,action){
		var data = action.result.data;

		if(data.provinceCode != null){
			cityStore.proxy =new Ext.data.HttpProxy({
   				url:'showCity.do?provinceId='+data.provinceCode,
   				method:'GET'
			});
			cityStore.load({ //加载下拉框的store
				callback:function(r,options,success){
					Ext.getCmp("cityCode").setValue(Ext.getCmp("cityCode").getValue());
				}
			});
		}
		if(data.industryTypeLevelOne != null){
			addIndustryTypeLevelTwoStore.proxy =new Ext.data.HttpProxy({
				url:'showIndustryTypeLevelTwo.do?LevelOneId='+data.industryTypeLevelOne,
				method:'GET'
			});     
			
			addIndustryTypeLevelTwoStore.load({ //加载下拉框的store
				callback:function(r,options,success){
					Ext.getCmp("IndustryTypeLevelTwo").setValue(Ext.getCmp("IndustryTypeLevelTwo").getValue());
				}
			});
		}
		Ext.getCmp("areaCodeNo").setValue(data.cityCode);
		Ext.getCmp("countryCodeNo").setValue(data.countryCode);
    },  
    failure:function(form,action){
     //Ext.Msg.alert('提示','数据加载失败');  
    }  
});

function editFunction(){

	if(addForm.form.isValid()){
		addForm.form.doAction('submit', { 
			url : 'customer/editGeneral.do', 
			method : 'post', 
			success : function() {
				Ext.Msg.alert('提示', '保存成功！'); 
			}, 
			failure : function() { 
				Ext.Msg.alert('提示', '保存失败！'); 
			} 
		}); 
	}
	
}

function editFunctionAndNext(){
	if(addForm.form.isValid()){
		addForm.form.doAction('submit', { 
			url : 'customer/editGeneral.do', 
			method : 'post', 
			success : function() {
				Ext.Msg.confirm("Confirm",'保存成功！<br/>是否继续添加地址信息？',function(bool){
					if(bool=='yes'){
						window.location.href = "view/customer/Customer_Address.jsp";
						return true;
					}
					else{
						return false;	
					}
				}); 
				//alert("成功");
				
			}, 
			failure : function() { 
				Ext.Msg.alert('提示', '编辑失败！'); 
			} 
		}); 
	}
}
       
}); 
